var validateEmail = (rule, value, callback) => {
  if (value === '') {
    callback(new Error('请输入邮箱'))
  } else {
    var patt = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
    if (!patt.test(value)) {
      callback(new Error('请输入正确的邮箱'))
    } else {
      callback()
    }
  }
}
var validatePhone = (rule, value, callback) => {
  if (value === '') {
    callback(new Error('请输入电话号码'))
  } else {
    var patt = /^1(3|4|5|6|7|8|9)\d{9}$/
    if (!patt.test(value)) {
      callback(new Error('请输入正确的电话号码'))
    } else {
      callback()
    }
  }
}
const commonRules = {
  email: {
    validator: validateEmail, trigger: 'blur'
  },
  phone: {
    validator: validatePhone, trigger: 'blur'
  }
}
export default commonRules
